//
//  UIBarButtonItem+Custom.m
//  HGroupwareHD
//
//  Created by Phan Quang Ha on 10/10/12.
//  Copyright (c) 2012 Hanbiro Inc. All rights reserved.
//

#import "UIBarButtonItem+Custom.h"

@implementation UIBarButtonItem (Custom)
+ (UIBarButtonItem *) barItemWithImage:(UIImage *)img size:(CGSize)size target:(id)target action:(SEL)selector
{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];

    [button setImage:img forState:UIControlStateNormal];
    
    button.frame= CGRectMake(0.0, 0.0, size.width, size.height);
    
    [button addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem *forward = [[UIBarButtonItem alloc] initWithCustomView:button];
    
    return forward;
}
@end
